<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        ?>

        $link_caweb = con_caweb();
        //
        $sql ="SELECT cliente,$soporte.mantis_project_table.name
    	FROM cabeceras_fac
    	INNER JOIN $soporte.mantis_project_table
    	ON $soporte.mantis_project_table.nit = cliente
    	GROUP BY cliente ORDER BY name";
     	$result=mysql_query($sql,$link_caweb) or die('Error SQL 1, '.mysql_error());
    	?>
    	<script type="text/javascript">
            function valida(valor){
                if($("#cliente").val()==""){
                    alert("Debe Elegir primero el cliente");
                    $("#cliente").focus();
                }
                else{
                    if(valor !=""){
                        $('#divDesaPed').load("cargasLoad", {opc:"DESPEDCAM",doc:valor,cliente:$("#cliente").val()});
                    }
                }
            }
    	</script>
        <span >Cliente</span>
        <select name="cliente" id="cliente" size="1" style="width: 850px;" onchange="
//            $('#datostipo').show();
//            $('#valorabonado').attr('value',0);
//            $.post('pasasesion.php',{campo:'clientefacturaabono',valor:this.value}, function () { });
//            $.post('pasasesion.php',{campo:'versolosincancelar',valor:'Si'}, function () { });
//            $.post('pasasesion.php',{campo:'versolovigentes',valor:'Si'}, function () { });
//            top.frames['InlineFrame1'].location='jqgridcarabono/index.php';
            ">

    	<?
        echo "<option value=''>Todas</option>";
        while($row = mysql_fetch_array($result))
        {
    	?>
                <option value="<? echo $row["cliente"]; ?>" >  <? echo $row["name"]." -> ".$row["cliente"]; ?> </option>
        <?
        }
        ?>
        </select>
        <br/>
        <span >Que desea desasignar?</span>
        <select name="documento" id="documento" onchange="valida(this.value);">
            <option value="">Elija</option>
            <option value="CAM">Cambio</option>
            <option value="PED">Pedido</option>
        </select>
        <div id="divDesaPed"></div>
        <?
		break;

    </body>
</html>
